import React, {useState} from 'react'
import { Button } from 'antd'
import './HooksDemo1.scss'
/**
 * @1 useState:React Hook的函数之一,目的是在函数组件中使用状态,以及修改状态,让组件更新
 * let [state, setState] = useState(initialState)
 *  
 */

const HooksDemo1 = function HooksDemo1() {
    const [num, setNum]=useState(0)

    return <div className="demo">
        <span className="num">{num}</span>
        <Button type='primary' size='small' onClick={()=>{
            setNum(num+10)
        }}>新增</Button>
    </div>
}

export default HooksDemo1